package com.action;

import com.controller.GetResultList;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by lirance on 16/5/18.
 */
public class getResultsByclustNum extends BaseAction {
    double lmd;
    int k;
    int Gn;

    List<Double> mae;
    List<Double> rmse;

    public double getLmd() {
        return lmd;
    }

    public void setLmd(double lmd) {
        this.lmd = lmd;
    }

    public int getK() {
        return k;
    }

    public void setK(int k) {
        this.k = k;
    }

    public int getGn() {
        return Gn;
    }

    public void setGn(int gn) {
        Gn = gn;
    }

    public List<Double> getMae() {
        return mae;
    }

    public void setMae(List<Double> mae) {
        this.mae = mae;
    }

    public List<Double> getRmse() {
        return rmse;
    }

    public void setRmse(List<Double> rmse) {
        this.rmse = rmse;
    }

    @Override
    public String execute() throws Exception {
        this.setMae(new ArrayList<>());
        this.setRmse(new ArrayList<>());
        if (lmd != 0) {
            for (int i = 1; i <= 5; i++) {
                /*List<Double> l = new GetMaeRmse().GetMaeRmse(lmd, k, 5 * i,30);*/
                List<Double> l=new GetResultList().GetResult(k, Gn, lmd, 5*i);
                mae.add(l.get(0));
                rmse.add(l.get(1));
            }
        }
        return SUCCESS;
    }
}
